/**
 * ClassName: Exer03
 * Package: PACKAGE_NAME
 * Description:
 *
 * @Author fjorid
 * @Create 2025/2/20 17:33
 * @Version 1.0
 */
public class Exer03 {
}
class Acconut{
    private int id;
    private double balance,annuallnterestRate;
    public  Acconut (int u,double b,double a){
        id = u;
        balance = b;
        annuallnterestRate = a;

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnuallnterestRate() {
        return annuallnterestRate;
    }

    public void setAnnuallnterestRate(double annuallnterestRate) {
        this.annuallnterestRate = annuallnterestRate;
    }
    public void withdraw(double amount){//取款方法
        if(balance >= amount){
            balance -= amount;
            System.out.println("取款成功，取出"+amount+"余额为"+balance);
        }else {
            System.out.println("取款失败");
        }

    }
    public void deposit(double amount){//存款方法
            balance += amount;
        System.out.println("存款成功，成功存入"+amount+"余额为"+balance);
    }
}
class Customer{
    private   String firstName,lastName;
    private Acconut acconut;

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public Customer(String f, String l){
        firstName = f;
        lastName = l;

    }
    public void setAcconut(Acconut a){
        acconut = a;

    }
    public Acconut getAcconut(){
        return acconut;
    }
}
class   Test{
    public static void main(String[] args) {
        Customer customer = new Customer("Smith","Jane");
        customer.setAcconut(new  Acconut(1000,2000,0.0123));
        customer.getAcconut().deposit(100);
        customer.getAcconut().withdraw(960);
        customer.getAcconut().withdraw(2000);
    }

}

